package exam.xiaohongshu.S1;

import java.util.*;

public class Main {

    public static int n;
    public static int m;
    public static int id;
    public static Node[] nums;

    static class Node implements Comparable<Node> {
        int weight;
        int num;

        Node(int n) {
            weight = 0;
            num = n;
        }

        @Override
        public int compareTo(Node o) {
            if (weight != o.weight)
                return o.weight - weight;
            return num - o.num;
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        id = sc.nextInt();
        nums = new Node[n];
        for (int i=0; i<n; ++i) {
            nums[i] = new Node(i+1);
            for (int j=0; j<m; ++j) {
                int w = sc.nextInt();
                nums[i].weight += w;
            }
        }
        System.out.println(solution());
    }

    private static int solution() {
        Arrays.sort(nums);
        int res = 0;
        for (int i=0; i< nums.length; ++i) {
            if (nums[i].num == id) {
                res = i + 1;
            }
        }
        return res;
    }
}